package com.hst.capacity.infra.persistence.jpa.journey;

import com.hst.capacity.domain.model.entity.journey.JourneyEntity;
import com.hst.capacity.domain.model.entity.journey.JourneyOrderEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

public interface JourneyOrderRepository extends JpaRepository<JourneyOrderEntity, String>, JpaSpecificationExecutor<JourneyOrderEntity> {

    @Query("select t from JourneyOrderEntity t where t.idJourney = ?1 and t.idOrder = ?2")
    JourneyOrderEntity findByIdJourneyAndIdOrder(String idJourney, String idOrder);

    @Query("select t from JourneyOrderEntity t where t.idOrder = ?1")
    JourneyOrderEntity findByIdOrder(String idOrder);

}